import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
// 导入字体图标
import './assets/fonts/iconfont.css'
// 导入 dayjs 事件处理模块
import dayjs from 'dayjs'
// 导入axios
import axios from 'axios'
// 导入树形表格
import treeTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
// 挂载富文本
Vue.use(VueQuillEditor)

Vue.component('treeTable', treeTable)
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // ☆☆☆☆☆☆return 必不可少
  return config
  // 失败输出错误
}, error => {
  return Promise.reject(error)
})
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
Vue.prototype.$http = axios

Vue.prototype.$dayjs = dayjs

Vue.config.productionTip = false

// 请求拦截器 设置请求头

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
